<script>
	export default {
		onLaunch: function() {
			const _this = this;
			_this.$api.findByHealthId().then((res)=>{
				if(res.data.returnCode == 200){
					const data = res.data.result
					const portrait = data.avatarAddress || 'http://jlm-file.oss-cn-hangzhou.aliyuncs.com/jlm-product/image/portrait/2020/11/9472ab92fe90400fbee424c2d6b02fb0.png'
					_this.$api.IMgetUserToken({id:data.id,name:data.realName,portrait:portrait}).then((responest)=>{
						const token = responest.data.result.token
						localStorage.setItem('IMTOKEN',token)
						_this.$im.connect({token:localStorage.IMTOKEN}).then(function(user) {
							localStorage.setItem('IMCOEDID',user.id)
						}).catch(function(error) {
							console.log('链接失败: ', error.code, error.msg);
						});
					})
				}  
			})
			console.log('App Launch')
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import "uview-ui/index.scss";
	/*每个页面公共css */
	.uni-input-placeholder {
		color: #999999;
		font-size: 28upx;
	}
</style>
